<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/common/taglibs.jsp" %>
<script type="text/javascript">
<!--

//选择完毕
function selectOK(id){
	var userid = $("#customerDispatchDlg input[type='radio'][checked='true']").val();
	var customers = "";
	$("#customerTable input[type='checkbox']").each(function(){
		if(this.checked){
			customers+=","+this.value;
			}
		});
	if(customers.length>0){
		customers = customers.substr(1);
	}
	$.ajax({
		url:"${ctx }/crm/customer!dispatch.action",
		async:false,
		data:"userid="+userid+"&customers="+customers,
		type:"POST",
		dataType:"json",
		success:function(json){
			alertMsg.info("分配成功！",{okCall:function(){
				navTab.reloadFlag("customerList");
				$.pdialog.closeCurrent();
				}});
			
			}
		});
	
}
//-->
</script>
<form id="pagerForm" method="post" action="${ctx }/account/user!selectUser.action">
	<input type="hidden" name="status" value="${param.status}">
	<input type="hidden" name="keywords" value="${param.keywords}" />
	<input type="hidden" name="pageNum"  value="${page.pageNo}" />
	<input type="hidden" name="numPerPage" id="numPerPage" value="${page.pageSize}" />
	<input type="hidden" name="orderField" value="${param.orderField}" />
	<input type="hidden" name="selectedId" id="selectedId" value="" />
	
	<input type="hidden" name="page.pageNo" id="pageNo" value="${page.pageNo}"/>
	<input type="hidden" name="page.orderBy" id="orderBy" value="${page.orderBy}"/>
	<input type="hidden" name="page.order" id="order" value="${page.order}"/>
	<input type="hidden" name="page.pageSize" id="pageSize" value="${page.pageSize}"/>
</form>

<div class="page">
	<div class="pageHeader">
		<form onsubmit="return dialogSearch(this);" action="${ctx }/account/user!selectUser.action" method="post">
		<div class="searchBar">
			<ul class="searchContent">
				<li>
					<label>姓名：</label>
					<input type="text" name="filter_LIKES_name" value="${param['filter_LIKES_name']}"/>
				</li>
			
			</ul>
			<div class="subBar">
				<ul>
					<li><div class="buttonActive"><div class="buttonContent"><button type="submit"> 检 索 </button></div></div></li>
					<li><div class="buttonActive"><div class="buttonContent"><button type="button" onclick="selectOK()"> 分 配  </button></div></div></li>
				</ul>
			</div>
		</div>
		</form>
	</div>
	<div class="pageContent" id="customerDispatchDlg">
		<table class="table" layouth="142">
			<thead>
				<tr>
				<th onclick="selectAll();">全选</th>
				<th>登录名</th>
				<th>姓名</th>
				<th>部门</th>
				<th>电邮</th>
				<th>手机</th>
				<th>角色</th>
				</tr>
			</thead>
			<tbody>
				<s:iterator value="page.result">
					<tr target="selectedId" rel="${id}">
						<td><input type="radio" name="dispatch" value="${id}"  /></td>
						<td>${loginName}</td>
						<td>${name}</td>
						<td>${organization.name}</td>
						<td>${email}</td>
						<td>${mobile}</td>
						<td>${roleNames}</td>
					</tr>
		</s:iterator>	
			</tbody>
		</table>
		<div class="panelBar">
			<div class="pages">
				<span>显示</span>
				<select name="numPerPage" id="showNumPerPage" onchange="dialogPageBreak({numPerPage:this.value})">
					<option value="14">14</option>
					<option value="20">20</option>
					<option value="50">50</option>
					<option value="100">100</option>
				</select>
				<span>条，共${page.totalCount}条</span>
			</div>
			
			<div class="pagination" targetType="dialog" totalCount="${page.totalCount}" numPerPage="${page.pageSize}" pageNumShown="10" currentPage="${page.pageNo}"></div>

		</div>
	</div>
</div>